#ifndef BOOKMANAGER_H_
#define BOOKMANAGER_H_
#include "../Entities/Book.h"
#include "VarFileManager.h"
#include "BlockFileManager.h"
#include "../Entities/EntityNotProcessed.h"
#include "../Entities/Record.h"
#include "../Commons/Configuration.h"
using namespace Entities;

namespace Managers
{

class BookManager {

private:

	static const unsigned int blockSize = 4096;

	VarFileManager* booksManager;
	BlockFileManager* entitiesNotProcessedManager;

protected:

	void addBookOffsetAtEntityNotProcessed(unsigned int offset, EntityType entityType, unsigned int blockNumber);

public:

	BookManager();
	void addBook(Book* bookToAdd);
	vector<Record*>* getBooksWithEntityNotProcessed(EntityType type);
	void setEntitiesProcessedOfType(EntityType type,int blockNumber);
	//metodos nuevos nacho
	bool hasNextBook(unsigned int offset);
	Book *getNextBook(unsigned int offset);
	unsigned int addBookInCopy(Book *bookToCopy);
	VarFileManager* getBooksManager();
	Book *getBookByOffset(int offset);
	//
	void updateBook(Book* bookToModify);
	virtual ~BookManager();
};

}
#endif /* BOOKMANAGER_H_ */
